<script setup lang="ts">
import type { OrderType } from '@/types/order'
import ConsultItem from './ConsultItem.vue'
defineProps<{
  type: OrderType
}>()
import { consult } from '../composable/user-consult'
const { loading, finished, consultList, onLoad, deleteConsult } = consult()
</script>

<template>
  <div class="consult-list">
    <van-list
      v-model:loading="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="() => onLoad(type)"
    >
      <div></div>
      <consult-item
        v-for="item in consultList"
        :key="item.id"
        :item="item"
        @delete-item="deleteConsult(item.id, item.type)"
      />
    </van-list>
  </div>
</template>

<style lang="scss" scoped>
.consult-list {
  padding: 10px 15px;
}
</style>
